#include <stdio.h>
#include "rc.driver.h"
#include <iostream>
#include <map>
int main(int argc , char** argv)
{
  std::map<std::string , std::string> stl_elem; // 计费元素
  stl_elem["a"] = "123";
  rc_driver rc;
  rc.is_trace_scanning= true;
  rc.is_trace_parsing = true;
  std::string line;
  while( std::getline(std::cin, line) )
  {
      printf("parsing line:%s\n",line.c_str());
      struct ast* a = NULL ;
      rc.parse_string(line.c_str() , &a);
      if( rc.check(stl_elem , a) != 0 )
      {
        printf("--- syntex error ---");
        continue;
      }
      int val;
      rc.eval(stl_elem , a , &val);
      printf("val:%d\n",val);
  }
  return 0;
}
